package com.lbs.demo.entities;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;

@Entity
@Table(name = "nodes", schema = "public", catalog = "osm_china")
public class NodesEntity {
    private long id;
    private int version;
    private int userId;
    private Timestamp tstamp;
    private long changesetId;
    private Serializable tags;
    private Serializable geom;

    @Id
    @Column(name = "id", nullable = false)
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "version", nullable = false)
    public int getVersion() {
        return version;
    }

    public void setVersion(int version) {
        this.version = version;
    }

    @Basic
    @Column(name = "user_id", nullable = false)
    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "tstamp", nullable = false)
    public Timestamp getTstamp() {
        return tstamp;
    }

    public void setTstamp(Timestamp tstamp) {
        this.tstamp = tstamp;
    }

    @Basic
    @Column(name = "changeset_id", nullable = false)
    public long getChangesetId() {
        return changesetId;
    }

    public void setChangesetId(long changesetId) {
        this.changesetId = changesetId;
    }

    @Basic
    @Column(name = "tags", nullable = true)
    public Serializable getTags() {
        return tags;
    }

    public void setTags(Serializable tags) {
        this.tags = tags;
    }

    @Basic
    @Column(name = "geom", nullable = true)
    public Serializable getGeom() {
        return geom;
    }

    public void setGeom(Serializable geom) {
        this.geom = geom;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        NodesEntity that = (NodesEntity) o;

        if (id != that.id) return false;
        if (version != that.version) return false;
        if (userId != that.userId) return false;
        if (changesetId != that.changesetId) return false;
        if (tstamp != null ? !tstamp.equals(that.tstamp) : that.tstamp != null) return false;
        if (tags != null ? !tags.equals(that.tags) : that.tags != null) return false;
        if (geom != null ? !geom.equals(that.geom) : that.geom != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) (id ^ (id >>> 32));
        result = 31 * result + version;
        result = 31 * result + userId;
        result = 31 * result + (tstamp != null ? tstamp.hashCode() : 0);
        result = 31 * result + (int) (changesetId ^ (changesetId >>> 32));
        result = 31 * result + (tags != null ? tags.hashCode() : 0);
        result = 31 * result + (geom != null ? geom.hashCode() : 0);
        return result;
    }
}
